<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .mask{
      position: fixed;
      left: 0;
      right: 0;
      top: 0;
      bottom: 0;
      background-color: rgba(0,0,0,.8);
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .content{
      width: 40%;
      height: 40%;
      background-color: #fff;
    }
  </style>
</head>
<body>
  <div id="app">
    <button @click="showMask">显示modal</button>
    <div class="mask" @click.self="hideMask" v-show="isShow">
      <div class="content">
        <div>dwodw</div>
        <button>按钮</button>
        <p>这是p</p>
      </div>
    </div>
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      data: {
        isShow: false
      },
      methods: {
        showMask(){
          this.isShow = true;
        },
        hideMask(){
          this.isShow = false;
        }
      }
    })
  </script>
</body>
</html>